#pragma once

#include "MTESrl.h"

#include "DataSchema.h"
#include "SectionConfig.h"

#include <string>
#include <list>
#include <memory>

namespace boost
{
	class thread;
}

class Connector
{
public:
	volatile bool stopped;

	bool IsLogonTime();
	void ProcessingCycle();
	void CheckConnection();
	void Start();
	void Stop();
	bool Connect();
	void Disconnect();
	bool ReConnect();

	bool ParseSchema();
	bool OpenTables();
	void CloseTables();
	bool ProcessTables();

	Connector(void);
	~Connector(void);
private:
	int32 idx;
	bool connected;
	std::auto_ptr<DataSchema> dataSchema;
	std::auto_ptr<SectionConfig> sectionConfig;
	std::tr1::shared_ptr<boost::thread> thread;
};

